//安全后端访问库
var jtoolsLibs = function () {
    var libs = {};
    var priLib = {};
    var solt = "/goBackend2020"
    //计算md5的值
    libs.md5 = function () {
        var ERROR = 'input is invalid type';
        var WINDOW = typeof window === 'object';
        var root = WINDOW ? window : {};
        if (root.JS_MD5_NO_WINDOW) {
            WINDOW = false;
        }
        var WEB_WORKER = !WINDOW && typeof self === 'object';
        var NODE_JS = !root.JS_MD5_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;
        if (NODE_JS) {
            root = global;
        } else if (WEB_WORKER) {
            root = self;
        }

        var ARRAY_BUFFER = !root.JS_MD5_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined';
        var HEX_CHARS = '0123456789abcdef'.split('');
        var EXTRA = [128, 32768, 8388608, -2147483648];
        var SHIFT = [0, 8, 16, 24];
        var OUTPUT_TYPES = ['hex', 'array', 'digest', 'buffer', 'arrayBuffer', 'base64'];
        var BASE64_ENCODE_CHAR = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');

        var blocks = [], buffer8;
        if (ARRAY_BUFFER) {
            var buffer = new ArrayBuffer(68);
            buffer8 = new Uint8Array(buffer);
            blocks = new Uint32Array(buffer);
        }

        if (root.JS_MD5_NO_NODE_JS || !Array.isArray) {
            Array.isArray = function (obj) {
                return Object.prototype.toString.call(obj) === '[object Array]';
            };
        }

        if (ARRAY_BUFFER && (root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) {
            ArrayBuffer.isView = function (obj) {
                return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer;
            };
        }

        var createOutputMethod = function (outputType) {
            return function (message) {
                return new Md5(true).update(message)[outputType]();
            };
        };


        var createMethod = function () {
            var method = createOutputMethod('hex');
            if (NODE_JS) {
                method = nodeWrap(method);
            }
            method.create = function () {
                return new Md5();
            };
            method.update = function (message) {
                return method.create().update(message);
            };
            for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
                var type = OUTPUT_TYPES[i];
                method[type] = createOutputMethod(type);
            }
            return method;
        };

        var nodeWrap = function (method) {
            var crypto = eval("require('crypto')");
            var Buffer = eval("require('buffer').Buffer");
            var nodeMethod = function (message) {
                if (typeof message === 'string') {
                    return crypto.createHash('md5').update(message, 'utf8').digest('hex');
                } else {
                    if (message === null || message === undefined) {
                        throw ERROR;
                    } else if (message.constructor === ArrayBuffer) {
                        message = new Uint8Array(message);
                    }
                }
                if (Array.isArray(message) || ArrayBuffer.isView(message) ||
                    message.constructor === Buffer) {
                    return crypto.createHash('md5').update(new Buffer(message)).digest('hex');
                } else {
                    return method(message);
                }
            };
            return nodeMethod;
        };

        /**
         * Md5 class
         * @class Md5
         * @description This is internal class.
         * @see {@link md5.create}
         */
        function Md5(sharedMemory) {
            if (sharedMemory) {
                blocks[0] = blocks[16] = blocks[1] = blocks[2] = blocks[3] =
                    blocks[4] = blocks[5] = blocks[6] = blocks[7] =
                        blocks[8] = blocks[9] = blocks[10] = blocks[11] =
                            blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
                this.blocks = blocks;
                this.buffer8 = buffer8;
            } else {
                if (ARRAY_BUFFER) {
                    var buffer = new ArrayBuffer(68);
                    this.buffer8 = new Uint8Array(buffer);
                    this.blocks = new Uint32Array(buffer);
                } else {
                    this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
                }
            }
            this.h0 = this.h1 = this.h2 = this.h3 = this.start = this.bytes = this.hBytes = 0;
            this.finalized = this.hashed = false;
            this.first = true;
        }

        /**
         * @method update
         * @memberof Md5
         * @instance
         * @description Update hash
         * @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
         * @returns {Md5} Md5 object.
         * @see {@link md5.update}
         */
        Md5.prototype.update = function (message) {
            if (this.finalized) {
                return;
            }

            var notString, type = typeof message;
            if (type !== 'string') {
                if (type === 'object') {
                    if (message === null) {
                        throw ERROR;
                    } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {
                        message = new Uint8Array(message);
                    } else if (!Array.isArray(message)) {
                        if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) {
                            throw ERROR;
                        }
                    }
                } else {
                    throw ERROR;
                }
                notString = true;
            }
            var code, index = 0, i, length = message.length, blocks = this.blocks;
            var buffer8 = this.buffer8;

            while (index < length) {
                if (this.hashed) {
                    this.hashed = false;
                    blocks[0] = blocks[16];
                    blocks[16] = blocks[1] = blocks[2] = blocks[3] =
                        blocks[4] = blocks[5] = blocks[6] = blocks[7] =
                            blocks[8] = blocks[9] = blocks[10] = blocks[11] =
                                blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
                }

                if (notString) {
                    if (ARRAY_BUFFER) {
                        for (i = this.start; index < length && i < 64; ++index) {
                            buffer8[i++] = message[index];
                        }
                    } else {
                        for (i = this.start; index < length && i < 64; ++index) {
                            blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];
                        }
                    }
                } else {
                    if (ARRAY_BUFFER) {
                        for (i = this.start; index < length && i < 64; ++index) {
                            code = message.charCodeAt(index);
                            if (code < 0x80) {
                                buffer8[i++] = code;
                            } else if (code < 0x800) {
                                buffer8[i++] = 0xc0 | (code >> 6);
                                buffer8[i++] = 0x80 | (code & 0x3f);
                            } else if (code < 0xd800 || code >= 0xe000) {
                                buffer8[i++] = 0xe0 | (code >> 12);
                                buffer8[i++] = 0x80 | ((code >> 6) & 0x3f);
                                buffer8[i++] = 0x80 | (code & 0x3f);
                            } else {
                                code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));
                                buffer8[i++] = 0xf0 | (code >> 18);
                                buffer8[i++] = 0x80 | ((code >> 12) & 0x3f);
                                buffer8[i++] = 0x80 | ((code >> 6) & 0x3f);
                                buffer8[i++] = 0x80 | (code & 0x3f);
                            }
                        }
                    } else {
                        for (i = this.start; index < length && i < 64; ++index) {
                            code = message.charCodeAt(index);
                            if (code < 0x80) {
                                blocks[i >> 2] |= code << SHIFT[i++ & 3];
                            } else if (code < 0x800) {
                                blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3];
                                blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
                            } else if (code < 0xd800 || code >= 0xe000) {
                                blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3];
                                blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];
                                blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
                            } else {
                                code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));
                                blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3];
                                blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3];
                                blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];
                                blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
                            }
                        }
                    }
                }
                this.lastByteIndex = i;
                this.bytes += i - this.start;
                if (i >= 64) {
                    this.start = i - 64;
                    this.hash();
                    this.hashed = true;
                } else {
                    this.start = i;
                }
            }
            if (this.bytes > 4294967295) {
                this.hBytes += this.bytes / 4294967296 << 0;
                this.bytes = this.bytes % 4294967296;
            }
            return this;
        };

        Md5.prototype.finalize = function () {
            if (this.finalized) {
                return;
            }
            this.finalized = true;
            var blocks = this.blocks, i = this.lastByteIndex;
            blocks[i >> 2] |= EXTRA[i & 3];
            if (i >= 56) {
                if (!this.hashed) {
                    this.hash();
                }
                blocks[0] = blocks[16];
                blocks[16] = blocks[1] = blocks[2] = blocks[3] =
                    blocks[4] = blocks[5] = blocks[6] = blocks[7] =
                        blocks[8] = blocks[9] = blocks[10] = blocks[11] =
                            blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
            }
            blocks[14] = this.bytes << 3;
            blocks[15] = this.hBytes << 3 | this.bytes >>> 29;
            this.hash();
        };

        Md5.prototype.hash = function () {
            var a, b, c, d, bc, da, blocks = this.blocks;

            if (this.first) {
                a = blocks[0] - 680876937;
                a = (a << 7 | a >>> 25) - 271733879 << 0;
                d = (-1732584194 ^ a & 2004318071) + blocks[1] - 117830708;
                d = (d << 12 | d >>> 20) + a << 0;
                c = (-271733879 ^ (d & (a ^ -271733879))) + blocks[2] - 1126478375;
                c = (c << 17 | c >>> 15) + d << 0;
                b = (a ^ (c & (d ^ a))) + blocks[3] - 1316259209;
                b = (b << 22 | b >>> 10) + c << 0;
            } else {
                a = this.h0;
                b = this.h1;
                c = this.h2;
                d = this.h3;
                a += (d ^ (b & (c ^ d))) + blocks[0] - 680876936;
                a = (a << 7 | a >>> 25) + b << 0;
                d += (c ^ (a & (b ^ c))) + blocks[1] - 389564586;
                d = (d << 12 | d >>> 20) + a << 0;
                c += (b ^ (d & (a ^ b))) + blocks[2] + 606105819;
                c = (c << 17 | c >>> 15) + d << 0;
                b += (a ^ (c & (d ^ a))) + blocks[3] - 1044525330;
                b = (b << 22 | b >>> 10) + c << 0;
            }

            a += (d ^ (b & (c ^ d))) + blocks[4] - 176418897;
            a = (a << 7 | a >>> 25) + b << 0;
            d += (c ^ (a & (b ^ c))) + blocks[5] + 1200080426;
            d = (d << 12 | d >>> 20) + a << 0;
            c += (b ^ (d & (a ^ b))) + blocks[6] - 1473231341;
            c = (c << 17 | c >>> 15) + d << 0;
            b += (a ^ (c & (d ^ a))) + blocks[7] - 45705983;
            b = (b << 22 | b >>> 10) + c << 0;
            a += (d ^ (b & (c ^ d))) + blocks[8] + 1770035416;
            a = (a << 7 | a >>> 25) + b << 0;
            d += (c ^ (a & (b ^ c))) + blocks[9] - 1958414417;
            d = (d << 12 | d >>> 20) + a << 0;
            c += (b ^ (d & (a ^ b))) + blocks[10] - 42063;
            c = (c << 17 | c >>> 15) + d << 0;
            b += (a ^ (c & (d ^ a))) + blocks[11] - 1990404162;
            b = (b << 22 | b >>> 10) + c << 0;
            a += (d ^ (b & (c ^ d))) + blocks[12] + 1804603682;
            a = (a << 7 | a >>> 25) + b << 0;
            d += (c ^ (a & (b ^ c))) + blocks[13] - 40341101;
            d = (d << 12 | d >>> 20) + a << 0;
            c += (b ^ (d & (a ^ b))) + blocks[14] - 1502002290;
            c = (c << 17 | c >>> 15) + d << 0;
            b += (a ^ (c & (d ^ a))) + blocks[15] + 1236535329;
            b = (b << 22 | b >>> 10) + c << 0;
            a += (c ^ (d & (b ^ c))) + blocks[1] - 165796510;
            a = (a << 5 | a >>> 27) + b << 0;
            d += (b ^ (c & (a ^ b))) + blocks[6] - 1069501632;
            d = (d << 9 | d >>> 23) + a << 0;
            c += (a ^ (b & (d ^ a))) + blocks[11] + 643717713;
            c = (c << 14 | c >>> 18) + d << 0;
            b += (d ^ (a & (c ^ d))) + blocks[0] - 373897302;
            b = (b << 20 | b >>> 12) + c << 0;
            a += (c ^ (d & (b ^ c))) + blocks[5] - 701558691;
            a = (a << 5 | a >>> 27) + b << 0;
            d += (b ^ (c & (a ^ b))) + blocks[10] + 38016083;
            d = (d << 9 | d >>> 23) + a << 0;
            c += (a ^ (b & (d ^ a))) + blocks[15] - 660478335;
            c = (c << 14 | c >>> 18) + d << 0;
            b += (d ^ (a & (c ^ d))) + blocks[4] - 405537848;
            b = (b << 20 | b >>> 12) + c << 0;
            a += (c ^ (d & (b ^ c))) + blocks[9] + 568446438;
            a = (a << 5 | a >>> 27) + b << 0;
            d += (b ^ (c & (a ^ b))) + blocks[14] - 1019803690;
            d = (d << 9 | d >>> 23) + a << 0;
            c += (a ^ (b & (d ^ a))) + blocks[3] - 187363961;
            c = (c << 14 | c >>> 18) + d << 0;
            b += (d ^ (a & (c ^ d))) + blocks[8] + 1163531501;
            b = (b << 20 | b >>> 12) + c << 0;
            a += (c ^ (d & (b ^ c))) + blocks[13] - 1444681467;
            a = (a << 5 | a >>> 27) + b << 0;
            d += (b ^ (c & (a ^ b))) + blocks[2] - 51403784;
            d = (d << 9 | d >>> 23) + a << 0;
            c += (a ^ (b & (d ^ a))) + blocks[7] + 1735328473;
            c = (c << 14 | c >>> 18) + d << 0;
            b += (d ^ (a & (c ^ d))) + blocks[12] - 1926607734;
            b = (b << 20 | b >>> 12) + c << 0;
            bc = b ^ c;
            a += (bc ^ d) + blocks[5] - 378558;
            a = (a << 4 | a >>> 28) + b << 0;
            d += (bc ^ a) + blocks[8] - 2022574463;
            d = (d << 11 | d >>> 21) + a << 0;
            da = d ^ a;
            c += (da ^ b) + blocks[11] + 1839030562;
            c = (c << 16 | c >>> 16) + d << 0;
            b += (da ^ c) + blocks[14] - 35309556;
            b = (b << 23 | b >>> 9) + c << 0;
            bc = b ^ c;
            a += (bc ^ d) + blocks[1] - 1530992060;
            a = (a << 4 | a >>> 28) + b << 0;
            d += (bc ^ a) + blocks[4] + 1272893353;
            d = (d << 11 | d >>> 21) + a << 0;
            da = d ^ a;
            c += (da ^ b) + blocks[7] - 155497632;
            c = (c << 16 | c >>> 16) + d << 0;
            b += (da ^ c) + blocks[10] - 1094730640;
            b = (b << 23 | b >>> 9) + c << 0;
            bc = b ^ c;
            a += (bc ^ d) + blocks[13] + 681279174;
            a = (a << 4 | a >>> 28) + b << 0;
            d += (bc ^ a) + blocks[0] - 358537222;
            d = (d << 11 | d >>> 21) + a << 0;
            da = d ^ a;
            c += (da ^ b) + blocks[3] - 722521979;
            c = (c << 16 | c >>> 16) + d << 0;
            b += (da ^ c) + blocks[6] + 76029189;
            b = (b << 23 | b >>> 9) + c << 0;
            bc = b ^ c;
            a += (bc ^ d) + blocks[9] - 640364487;
            a = (a << 4 | a >>> 28) + b << 0;
            d += (bc ^ a) + blocks[12] - 421815835;
            d = (d << 11 | d >>> 21) + a << 0;
            da = d ^ a;
            c += (da ^ b) + blocks[15] + 530742520;
            c = (c << 16 | c >>> 16) + d << 0;
            b += (da ^ c) + blocks[2] - 995338651;
            b = (b << 23 | b >>> 9) + c << 0;
            a += (c ^ (b | ~d)) + blocks[0] - 198630844;
            a = (a << 6 | a >>> 26) + b << 0;
            d += (b ^ (a | ~c)) + blocks[7] + 1126891415;
            d = (d << 10 | d >>> 22) + a << 0;
            c += (a ^ (d | ~b)) + blocks[14] - 1416354905;
            c = (c << 15 | c >>> 17) + d << 0;
            b += (d ^ (c | ~a)) + blocks[5] - 57434055;
            b = (b << 21 | b >>> 11) + c << 0;
            a += (c ^ (b | ~d)) + blocks[12] + 1700485571;
            a = (a << 6 | a >>> 26) + b << 0;
            d += (b ^ (a | ~c)) + blocks[3] - 1894986606;
            d = (d << 10 | d >>> 22) + a << 0;
            c += (a ^ (d | ~b)) + blocks[10] - 1051523;
            c = (c << 15 | c >>> 17) + d << 0;
            b += (d ^ (c | ~a)) + blocks[1] - 2054922799;
            b = (b << 21 | b >>> 11) + c << 0;
            a += (c ^ (b | ~d)) + blocks[8] + 1873313359;
            a = (a << 6 | a >>> 26) + b << 0;
            d += (b ^ (a | ~c)) + blocks[15] - 30611744;
            d = (d << 10 | d >>> 22) + a << 0;
            c += (a ^ (d | ~b)) + blocks[6] - 1560198380;
            c = (c << 15 | c >>> 17) + d << 0;
            b += (d ^ (c | ~a)) + blocks[13] + 1309151649;
            b = (b << 21 | b >>> 11) + c << 0;
            a += (c ^ (b | ~d)) + blocks[4] - 145523070;
            a = (a << 6 | a >>> 26) + b << 0;
            d += (b ^ (a | ~c)) + blocks[11] - 1120210379;
            d = (d << 10 | d >>> 22) + a << 0;
            c += (a ^ (d | ~b)) + blocks[2] + 718787259;
            c = (c << 15 | c >>> 17) + d << 0;
            b += (d ^ (c | ~a)) + blocks[9] - 343485551;
            b = (b << 21 | b >>> 11) + c << 0;

            if (this.first) {
                this.h0 = a + 1732584193 << 0;
                this.h1 = b - 271733879 << 0;
                this.h2 = c - 1732584194 << 0;
                this.h3 = d + 271733878 << 0;
                this.first = false;
            } else {
                this.h0 = this.h0 + a << 0;
                this.h1 = this.h1 + b << 0;
                this.h2 = this.h2 + c << 0;
                this.h3 = this.h3 + d << 0;
            }
        };

        /**
         * @method hex
         * @memberof Md5
         * @instance
         * @description Output hash as hex string
         * @returns {String} Hex string
         * @see {@link md5.hex}
         * @example
         * hash.hex();
         */
        Md5.prototype.hex = function () {
            this.finalize();

            var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3;

            return HEX_CHARS[(h0 >> 4) & 0x0F] + HEX_CHARS[h0 & 0x0F] +
                HEX_CHARS[(h0 >> 12) & 0x0F] + HEX_CHARS[(h0 >> 8) & 0x0F] +
                HEX_CHARS[(h0 >> 20) & 0x0F] + HEX_CHARS[(h0 >> 16) & 0x0F] +
                HEX_CHARS[(h0 >> 28) & 0x0F] + HEX_CHARS[(h0 >> 24) & 0x0F] +
                HEX_CHARS[(h1 >> 4) & 0x0F] + HEX_CHARS[h1 & 0x0F] +
                HEX_CHARS[(h1 >> 12) & 0x0F] + HEX_CHARS[(h1 >> 8) & 0x0F] +
                HEX_CHARS[(h1 >> 20) & 0x0F] + HEX_CHARS[(h1 >> 16) & 0x0F] +
                HEX_CHARS[(h1 >> 28) & 0x0F] + HEX_CHARS[(h1 >> 24) & 0x0F] +
                HEX_CHARS[(h2 >> 4) & 0x0F] + HEX_CHARS[h2 & 0x0F] +
                HEX_CHARS[(h2 >> 12) & 0x0F] + HEX_CHARS[(h2 >> 8) & 0x0F] +
                HEX_CHARS[(h2 >> 20) & 0x0F] + HEX_CHARS[(h2 >> 16) & 0x0F] +
                HEX_CHARS[(h2 >> 28) & 0x0F] + HEX_CHARS[(h2 >> 24) & 0x0F] +
                HEX_CHARS[(h3 >> 4) & 0x0F] + HEX_CHARS[h3 & 0x0F] +
                HEX_CHARS[(h3 >> 12) & 0x0F] + HEX_CHARS[(h3 >> 8) & 0x0F] +
                HEX_CHARS[(h3 >> 20) & 0x0F] + HEX_CHARS[(h3 >> 16) & 0x0F] +
                HEX_CHARS[(h3 >> 28) & 0x0F] + HEX_CHARS[(h3 >> 24) & 0x0F];
        };

        /**
         * @method toString
         * @memberof Md5
         * @instance
         * @description Output hash as hex string
         * @returns {String} Hex string
         * @see {@link md5.hex}
         * @example
         * hash.toString();
         */
        Md5.prototype.toString = Md5.prototype.hex;

        /**
         * @method digest
         * @memberof Md5
         * @instance
         * @description Output hash as bytes array
         * @returns {Array} Bytes array
         * @see {@link md5.digest}
         * @example
         * hash.digest();
         */
        Md5.prototype.digest = function () {
            this.finalize();

            var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3;
            return [
                h0 & 0xFF, (h0 >> 8) & 0xFF, (h0 >> 16) & 0xFF, (h0 >> 24) & 0xFF,
                h1 & 0xFF, (h1 >> 8) & 0xFF, (h1 >> 16) & 0xFF, (h1 >> 24) & 0xFF,
                h2 & 0xFF, (h2 >> 8) & 0xFF, (h2 >> 16) & 0xFF, (h2 >> 24) & 0xFF,
                h3 & 0xFF, (h3 >> 8) & 0xFF, (h3 >> 16) & 0xFF, (h3 >> 24) & 0xFF
            ];
        };

        /**
         * @method array
         * @memberof Md5
         * @instance
         * @description Output hash as bytes array
         * @returns {Array} Bytes array
         * @see {@link md5.array}
         * @example
         * hash.array();
         */
        Md5.prototype.array = Md5.prototype.digest;

        /**
         * @method arrayBuffer
         * @memberof Md5
         * @instance
         * @description Output hash as ArrayBuffer
         * @returns {ArrayBuffer} ArrayBuffer
         * @see {@link md5.arrayBuffer}
         * @example
         * hash.arrayBuffer();
         */
        Md5.prototype.arrayBuffer = function () {
            this.finalize();

            var buffer = new ArrayBuffer(16);
            var blocks = new Uint32Array(buffer);
            blocks[0] = this.h0;
            blocks[1] = this.h1;
            blocks[2] = this.h2;
            blocks[3] = this.h3;
            return buffer;
        };

        /**
         * @method buffer
         * @deprecated This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.
         * @memberof Md5
         * @instance
         * @description Output hash as ArrayBuffer
         * @returns {ArrayBuffer} ArrayBuffer
         * @see {@link md5.buffer}
         * @example
         * hash.buffer();
         */
        Md5.prototype.buffer = Md5.prototype.arrayBuffer;

        /**
         * @method base64
         * @memberof Md5
         * @instance
         * @description Output hash as base64 string
         * @returns {String} base64 string
         * @see {@link md5.base64}
         * @example
         * hash.base64();
         */
        Md5.prototype.base64 = function () {
            var v1, v2, v3, base64Str = '', bytes = this.array();
            for (var i = 0; i < 15;) {
                v1 = bytes[i++];
                v2 = bytes[i++];
                v3 = bytes[i++];
                base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] +
                    BASE64_ENCODE_CHAR[(v1 << 4 | v2 >>> 4) & 63] +
                    BASE64_ENCODE_CHAR[(v2 << 2 | v3 >>> 6) & 63] +
                    BASE64_ENCODE_CHAR[v3 & 63];
            }
            v1 = bytes[i];
            base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] +
                BASE64_ENCODE_CHAR[(v1 << 4) & 63] +
                '==';
            return base64Str;
        };
        return createMethod();
    }();

    libs.newUUID = function () {
        var s = [];
        var hexDigits = "0123456789abcdef";
        for (var i = 0; i < 36; i++) {
            s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
        }
        s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
        s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
        s[8] = s[13] = s[18] = s[23] = "-";
        return s.join("");
    };

    priLib.getParamsSec = function (params) {
        if (!params) {
            return libs.md5("")
        }
        var keys = Object.keys(params);
        keys.sort();
        // console.log(keys)
        var strArr = [];
        for (var i = 0; i < keys.length; i++) {
            strArr.push(params[keys[i]]);
        }
        // console.log(strArr.join(""))
        return libs.md5(strArr.join(""));
    };

    //设置cookies
    libs.setCookie = function (name, value, days) {
        if (document && document.cookie) {
            days = days || 365;
            var exp = new Date();
            exp.setTime(exp.getTime() + days * 24 * 60 * 60 * 1000);
            document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString() + ";path=/";
        }
    };

    //读取cookies
    libs.getCookie = function (cname) {
        var name = cname + "=";
        var ca = "";
        try {
            ca = document.cookie.split(';');
        } catch (e) {
            ca = [];
        }
        for (var i = 0; i < ca.length; i++) {
            var c = ca[i];
            while (c.charAt(0) == ' ') {
                c = c.substring(1);
            }
            if (c.indexOf(name) == 0) {
                return unescape(c.substring(name.length, c.length));
            }
        }
        return "";
    };

    //删除cookies
    libs.delCookie = function (name) {
        if (document && document.cookie) {
            var exp = new Date();
            exp.setTime(exp.getTime() - 1);
            var cval = getCookie(name);
            if (cval != null)
                document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
        }
    };
    var isPlainObject = function (obj) {
        return Object.prototype.toString.call(obj) === '[object Object]' && 'isPrototypeOf' in obj;
    };

    var buildParams = function (prefix, obj, add) {
        var name, rbracket = /\[\]$/;
        if (Array.isArray(obj)) {
            // Serialize array item.
            for (var i = 0; i < obj.length; i++) {
                var v = obj[i];
                if (rbracket.test(prefix)) {
                    // Treat each array item as a scalar.
                    add(prefix, v);
                } else {
                    buildParams(prefix + "[" + (typeof v === "object" && v != null ? i : "") + "]", v, add);
                }
            }
        } else if (isPlainObject(obj)) {
            // Serialize object item.
            for (name in obj) {
                buildParams(prefix + "[" + name + "]", obj[name], add);
            }
        } else {
            // Serialize scalar item.
            add(prefix, obj);
        }
    };
    var toParam = function (a) {
        if (a == null || a == undefined) {
            return "";
        }

        var prefix,
            s = [],
            add = function (key, value) {
                if (value == null || value == undefined) {
                    value = ""
                }
                s[s.length] = encodeURIComponent(key) + "=" +
                    encodeURIComponent(value == null ? "" : value);
            };

        for (prefix in a) {
            buildParams(prefix, a[prefix], add);
        }
        // Return the resulting serialization
        return s.join("&");
    };

    function objectParseUrlParams(data) {
        return toParam(data);
    }

    libs.httpAjax = function (method, url, params, getJson, callback) {
        getJson = !!getJson;
        callback = callback || function (status, data) {
        };
        var request = new XMLHttpRequest();
        request.onerror = function () {
            callback(false, "network")
        };

        request.ontimeout = function () {
            callback(false, "timeout")
        };

        request.onload = function () {
            // console.log(request.readyState)
            if (request.readyState === 4 && (request.status >= 200 && request.status < 400)) {
                var response = request.responseText;
                try {
                    if (getJson) {
                        var rsp = JSON.parse(response);
                        // console.log("Status:GET response! " + response);
                        callback(true, rsp);
                    } else {
                        callback(true, response);
                    }
                } catch (e) {
                    callback(false, "jsonparse");
                }
            }
        };

        request.timeout = 20000;

        var paramsUrl = "";
        if (params) {
            paramsUrl = objectParseUrlParams(params)
        }
        if (method.toLowerCase() === "get" && paramsUrl.length > 0) {
            if (url.indexOf("?") > -1) {
                url += "&" + paramsUrl
            } else {
                url += "?" + paramsUrl
            }
        }

        request.open(method.toUpperCase(), url, true);
        // request.withCredentials = true
        request.setRequestHeader('Access-Control-Allow-Origin', '*');
        request.setRequestHeader('Access-Control-Allow-Methods', 'GET, POST');
        request.setRequestHeader('Access-Control-Allow-Headers', 'x-requested-with,content-type,Access-Token');
        request.setRequestHeader('Access-Control-Expose-Headers', '*');
        request.setRequestHeader("Access-Control-Allow-Credentials", "true");
        request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");

        if (method.toLowerCase() === "get") {
            try {
                request.send();
            } catch (e) {
                console.log(e);
                callback(false, "network")
            }
        } else {
            try {
                request.send(paramsUrl);
            } catch (e) {
                console.log(e);
                callback(false, "network")
            }
        }
    };

    libs.httpJsonPost = function (url, params, cbk) {
        libs.httpAjax("post", url, params, true, cbk);
    };
    libs.httpJsonGet = function (url, params, cbk) {
        libs.httpAjax("get", url, params, true, cbk);
    };

    libs.httpTextGet = function (url, params, cbk) {
        libs.httpAjax("get", url, params, false, cbk);
    };
    libs.httpTextPost = function (url, params, cbk) {
        libs.httpAjax("post", url, params, false, cbk);
    };


    libs.secPostJson = function (url, params, cbk) {
        params.sec = priLib.getParamsSec(params);
        params.secc = libs.md5(params.sec + solt);
        libs.httpJsonPost(url, params, cbk)
    };

    libs.secGetJson = function (url, params, cbk) {
        params.sec = priLib.getParamsSec(params);
        params.secc = libs.md5(params.sec + solt);
        libs.httpJsonGet(url, params, cbk)
    };
    libs.getWsSdk = function (uid, uidsec, label) {
        var sdk = {ws: null, cid: null, cidsec: null, label: ""};
        var cbkMap = {};

        sdk.cid = uid || libs.getCookie("jtoolsSdk.uid");
        if (!sdk.cid) sdk.cid = "";

        sdk.cidsec = uidsec || libs.getCookie("jtoolsSdk.uidsec");
        if (!sdk.cidsec) sdk.cidsec = "";

        sdk.label = label || libs.getCookie("jtoolsSdk.label");
        if (!sdk.label) sdk.label = "";

        //人工停止
        var handStop = false;


        sdk.sendMsgToOne = function (to, msg, cbk) {
            var uuid = libs.newUUID();
            cbkMap[uuid] = cbk;
            var m = JSON.stringify({
                cbk: uuid,
                sender: sdk.cid,
                recipient: to,
                content: msg
            });
            // console.log("sendMsgToOne", m);
            sdk.ws && sdk.ws.send(m)
        };

        sdk.sendMsgToRoom = function (appid, roomid, msg, cbk) {
            var uuid = libs.newUUID();
            cbkMap[uuid] = cbk;
            var m = JSON.stringify({
                cbk: uuid,
                sender: sdk.cid,
                appid: appid,
                roomid: roomid,
                time: new Date(),
                content: msg
            });
            // console.log("sendMsgToRoom", m);
            sdk.ws && sdk.ws.send(m)
        };

        sdk.sendToSystem = function (command, appid, roomid, param1, param2, cbk) {
            var uuid = libs.newUUID();
            cbkMap[uuid] = cbk;
            var m = JSON.stringify({
                cbk: uuid,
                sender: sdk.cid,
                recipient: "system",
                content: {
                    ctype: command,
                    appid: appid,
                    roomid: roomid,
                    param1: param1,
                    param2: param2
                }
            });
            // console.log(sdk.sendToSystem, m);
            sdk.ws && sdk.ws.send(m)
        };


        sdk.getRoomMembers = function (appid, roomid, cbk) {
            sdk.sendToSystem("room.members", appid, roomid, "", "", cbk)
        };

        sdk.roomIn = function (appid, roomid, label, cbk) {
            sdk.sendToSystem("room.in", appid, roomid, label, "", cbk)
        };

        sdk.roomOut = function (appid, roomid, cbk) {
            sdk.sendToSystem("room.out", appid, roomid, "", "", cbk)
        };

        var userParams = {};
        var pingInterval = 0;
        //ws://127.0.0.1:9600/ws
        sdk.startWs = function (url, onmessage, onopen, onclose) {
            handStop = false;
            userParams.url = url;
            userParams.onopen = onopen || function (e) {

            };
            userParams.onmessage = onmessage || function (e) {

            };
            userParams.onclose = onclose || function (e) {

            };

            var urlQueryObject = {uid: sdk.cid, uidsec: sdk.cidsec, label: sdk.label};
            var urlQueryStr = Object.keys(urlQueryObject).map(function (key) {
                return encodeURIComponent(key) + "=" + encodeURIComponent(urlQueryObject[key]);
            }).join("&");

            // console.log(urlQueryStr)

            sdk.ws = new WebSocket(userParams.url + "?" + urlQueryStr);
            sdk.ws.onmessage = function (evt) {
                // console.log("Received Message: " + evt.data);
                if (evt.data === "pong") return;
                try {
                    var json = JSON.parse(evt.data);
                    if (json['code'] === 199) {
                        sdk.cid = json['data1'];
                        sdk.cidsec = json['data2'];

                        //收到uid后，才算正真打开了连接
                        userParams.onopen();
                        libs.setCookie("jtoolsSdk.uid", sdk.cid);
                        libs.setCookie("jtoolsSdk.uidsec", sdk.cidsec);
                        libs.setCookie("jtoolsSdk.label", sdk.label)
                    } else if (json['code'] === 198) {
                        userParams.onmessage(json)
                    } else {
                        if (json['cbk']) {
                            var uuid = json['cbk'];
                            if (cbkMap[uuid]) {
                                cbkMap[uuid](json);
                                cbkMap[uuid] = null;
                            } else {
                                // console.log(json)
                            }
                        } else {
                            // console.log(json)
                        }
                    }
                } catch (e) {
                    console.error(e)
                }
            };
            sdk.ws.onopen = function (e) {
                console.log("Connected");
                clearInterval(pingInterval);
                pingInterval = setInterval(function () {
                    if (!sdk.ws) clearInterval(pingInterval);
                    sdk.ws && sdk.ws.send("ping")
                }, 30000)
            };
            sdk.ws.onclose = function (e) {
                console.log("Connection closed.");
                sdk.ws = null;
                userParams.onclose(e);
                if (!handStop) {
                    setTimeout(function () {
                        sdk.startWs(userParams.url, userParams.onmessage, userParams.onopen, userParams.onclose)
                    }, 3000)
                }
            };
        };

        sdk.close = function () {
            handStop = true;
            sdk.ws && sdk.ws.close();
            sdk.ws = null
        };


        //readyState属性返回实例对象的当前状态，共有四种。
        //CONNECTING：值为0，表示正在连接。
        //OPEN：值为1，表示连接成功，可以通信了。
        //CLOSING：值为2，表示连接正在关闭。
        //CLOSED：值为3，表示连接已经关闭，或者打开连接失败
        //例如：if (ws.readyState == WebSocket.CONNECTING) { }
        sdk.getSocketStatus = function () {
            if (sdk.ws) {
                return sdk.ws.readyState
            } else {
                return null
            }
        };

        sdk.getUid = function () {
            return sdk.cid
        };

        return sdk;
    };
    return libs
}();

module.exports = jtoolsLibs;